package com.joy.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * 这里的Validator要导jfinal的包
 */
public class LoginValidator extends Validator {
    @Override
    protected void validate(Controller c) {
        validateRequiredString("username","nameError","用户名不能为空");
        validateRequiredString("password","passwordError","密码不能为空");
    }

    //这里是当发生上面条件成立的时候，调用这个，并且会将上面的值设置进去
    @Override
    protected void handleError(Controller c) {

        c.renderJsp("index.jsp");
    }
}
